import { ProfileType } from '@/store/reducer/user';
import request from '@/utils/request';

export const getUserInfoAPI = () => {
  return request({
    url: '/v1_0/user',
  });
};

/** 获取个人资料 */
export const getUserProfileAPI = () => {
  return request({
    url: '/v1_0/user/profile',
  });
};

/** 编辑头像 */
export const updatePhotoAPI = (data: FormData) => {
  return request({
    url: '/v1_0/user/photo',
    method: 'patch',
    data,
  });
};

/** 更新个人资料 */
export const updateProfileAPI = (data: Partial<ProfileType>) => {
  return request({
    url: '/v1_0/user/profile',
    method: 'patch',
    data,
  });
};
